﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="VPCControl.aspx.cs" Inherits="GPSTrackingWebsiteManager.Manager.Pages.VPCControl" %>
<%@ Register Src="~/Manager/UserControls/DriverSearch.ascx" TagPrefix="uc1" TagName="DriverSearch" %>
<%@ Register Src="~/Manager/UserControls/GPSSearch.ascx" TagPrefix="uc1" TagName="GPSSearch" %>
<%@ Register Src="~/Manager/UserControls/BusRoutesSearch.ascx" TagPrefix="uc1" TagName="BusRoutesSearch" %>

<!DOCTYPE html>

<link href="../../Css/GPSTrackingWebsite.css" rel="stylesheet" />
<link href="../../Css/messi.css" rel="stylesheet" />
<script src="../../Javascript/jquery-1.11.1.min.js"></script>
<script src="../../Javascript/messi.js"></script>
<script src="../../Javascript/Custom.js"></script>
<script src="../../Javascript/WindowMessageManager.js"></script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Asignación de Buses</title><telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
    <script type="text/javascript">
        function resizeGrid() {
            var tableView = $find("<%=VPCControlGrid.ClientID %>");
            tableView.get_element().style.height = (window.innerHeight-260) + "px";

            document.getElementById('HiddenFieldHeight').value = (window.innerHeight);
        }

        //Windows Message Manager 
        var objWindowsMessageManager = new WindowsMessageManager();
    </script>
</telerik:RadScriptBlock>
</head>
<body onresize="resizeGrid()" style="overflow: hidden">
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                        <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="btnAddBusRoutes">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rmpVPCControl" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldError" /> 
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnSearchVPCControlGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="VPCControlGrid" LoadingPanelID="RadAjaxLoadingPanel2" />
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldError" /> 
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>
        
        <asp:HiddenField ID="HiddenFieldHeight" runat="server" Value="323" />
        <asp:HiddenField ID="HiddenFieldError" runat="server" Value="" />

        <telerik:RadTabStrip ID="rtsVPControl" runat="server" SelectedIndex="0" MultiPageID="rmpVPCControl" ></telerik:RadTabStrip>
        <telerik:RadMultiPage ID="rmpVPCControl" runat="server" SelectedIndex="0">
        <telerik:RadPageView ID="rpvVPCControl" runat="server">


            <table>
                <tr>
                        
                    <td>
                        <telerik:RadCalendar ID="RadCalendar1" runat="server" CultureInfo="es-CR"></telerik:RadCalendar>
                           
                    </td>
                       
                    <td>
                        <fieldset>
                        <table>
                            <tr>
                                <td colspan="3">
                                    <table class="auto-style1">
                                        <tr>
                                            <td>Conductor ID</td>
                                            <td>Identificación</td>
                                            <td>Seudónimo</td>
                                            <td>Nombre</td>
                                            <td nowrap>Primer Apellido</td>
                                            <td nowrap>Segundo Apellido</td>
                                            <td>Teléfono</td>
                                        </tr>
                                        <tr>
                                            <td nowrap>
                                                <telerik:RadTextBox ID="txtDriverID" runat="server" Width="100px" ReadOnly="true">
                                                </telerik:RadTextBox>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtIdentification" runat="server" ReadOnly="true" Width="100px">
                                                </telerik:RadTextBox>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtDriverName" runat="server" ReadOnly="true" Width="100px">
                                                </telerik:RadTextBox>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtName" runat="server" ReadOnly="true" Width="100px">
                                                </telerik:RadTextBox>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtFirstSurname" runat="server" ReadOnly="true" Width="125px">
                                                </telerik:RadTextBox>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtSecondSurname" runat="server" ReadOnly="true" Width="125px">
                                                </telerik:RadTextBox>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtPhone" runat="server" ReadOnly="true" Width="100px">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                               
                            </tr>
                                                       
                            <tr>
                                <td colspan="3">
                                    <table class="auto-style1">
                                        <tr>
                                            <td>Imei</td>
                                            <td>Nombre</td>
                                            <td>Nº Sim</td>
                                            <td>Descripción</td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <telerik:RadTextBox ID="txtImei" runat="server" ReadOnly="true" Width="150px">
                                                </telerik:RadTextBox>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtImeiName" runat="server" ReadOnly="true" Width="100px">
                                                </telerik:RadTextBox>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtSimNumber" runat="server" ReadOnly="true" Width="100px">
                                                </telerik:RadTextBox>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtDescription" runat="server" ReadOnly="true" Width="380px">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>

                            <tr>
                                <td> <table>
                                        <tr>
                                            <td>Ruta ID</td>
                                            <td>Ruta</td>
                                        </tr>
                                        <tr>
                                            <td nowrap>
                                                <telerik:RadTextBox ID="txtBusRouteID" runat="server" Width="100px" ReadOnly="true">
                                                </telerik:RadTextBox>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtBusRouteName" runat="server" ReadOnly="true" Width="100px">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                               
                                    <td>
                                        <table>
                                            <tr>
                                                <td>Hora Desde </td>
                                                <td>Hora Hasta </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <telerik:RadTimePicker ID="RadTimePicker1" runat="server" Width="100px">
                                                    </telerik:RadTimePicker>
                                                </td>
                                                <td>
                                                    <telerik:RadTimePicker ID="RadTimePicker2" runat="server" Width="100px">
                                                    </telerik:RadTimePicker>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td>
                                        <telerik:RadButton ID="btnAddBusRoutes" runat="server" Height="32px" OnClick="btnAddBusRoutes_Click" Text="Agregar Ruta" ToolTip="Agregar una Ruta" Width="32px">
                                            <Image ImageUrl="../../Template/Icons/32px/add-event-icon.png" />
                                        </telerik:RadButton>
                                    </td>
                               
                            </tr>
                        </table>
                 </fieldset>
                    </td>
                </tr>
            </table>
            


        <div align=right>
            <telerik:RadDatePicker ID="DateSelectedBegin" runat="server" Calendar-CultureInfo="es-CR" DateInput-DateFormat="dd/MM/yyyy"></telerik:RadDatePicker>
            <telerik:RadDatePicker ID="DateSelectedEnd" runat="server" Calendar-CultureInfo="es-CR" DateInput-DateFormat="dd/MM/yyyy"></telerik:RadDatePicker>
            <telerik:RadButton ID="btnSearchVPCControlGrid" runat="server" Text="Buscador" Height="32px" Width="32px" AutoPostBack="True" OnClick="btnSearchVPCControlGrid_Click" ToolTip="Consultar">
                <Image ImageUrl="../../Template/Icons/32px/Actions-document-find-icon.png" />
            </telerik:RadButton>
        </div>
            <br />
            <telerik:RadGrid ID="VPCControlGrid" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100%" OnNeedDataSource="VPCControlGrid_NeedDataSource" OnDeleteCommand="VPCControlGrid_DeleteCommand" AllowSorting="true" GroupingSettings-CaseSensitive="false">
		    <MasterTableView EditMode="PopUp" EditFormSettings-PopUpSettings-Modal="true" EditFormSettings-CaptionFormatString="Modo Edición" CommandItemDisplay="TopAndBottom" NoMasterRecordsText="No hay registros" AllowFilteringByColumn="true" TableLayout="Auto">
                    <CommandItemTemplate>
                        <div style="padding: 5px 5px;"> Información Registrada: 
                                <asp:LinkButton ID="lbClearFilters" runat="server" OnClick="lbClearFilters_Click"  Visible='<%# !VPCControlGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/mixx-icon.png"/>Limpiar Filtros</asp:LinkButton>                                                                               
                            <asp:LinkButton ID="lbAddDriver" runat="server" OnClientClick="OpenDriverSearch()"><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/text-plus-icon.png"/>Asociar Conductor</asp:LinkButton>     
                            <asp:LinkButton ID="lbAddGPS" runat="server" OnClientClick="OpenGPSSearch()"><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/text-plus-icon.png"/>Asociar Vehículo</asp:LinkButton>     
                            <asp:LinkButton ID="lbAddRoute" runat="server" OnClientClick="OpenBusRoutesSearch()"><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/text-plus-icon.png"/>Asociar Ruta</asp:LinkButton>     
                            <asp:LinkButton ID="lbShowError" runat="server" OnClick="lbShowError_Click" Visible='<%# HiddenFieldError.Value == string.Empty ? false : true %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/bug-icon.png"/>Error Técnico</asp:LinkButton>                                                                                                               
                        </div>                        
                    </CommandItemTemplate>

                    <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>

                    <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>

                    <Columns>
                        <telerik:GridButtonColumn HeaderStyle-Width="25px" ConfirmText="¿Desea eliminar el registro?" ConfirmDialogType="RadWindow" ConfirmDialogHeight="120" ConfirmDialogWidth="270" ConfirmTitle="Eliminar" ButtonType="ImageButton" CommandName="Delete" Text="Eliminar" ItemStyle-Width="20px" />
                        <telerik:GridBoundColumn DataField="NumControl" HeaderText="Número Control" UniqueName="NumControl" Display="false" ForceExtractValue="Always">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="NumCard" HeaderText="Número Tarjeta" UniqueName="NumCard" HeaderStyle-Width="100px" FilterControlWidth="80px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" ItemStyle-HorizontalAlign="Center" >
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="DriverID" HeaderText="Conductor ID" UniqueName="DriverID" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="DriverName" HeaderText="Seudónimo" UniqueName="DriverName" HeaderStyle-Width="100px" FilterControlWidth="80px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" >
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="GPSImei" HeaderText="GPSImei" UniqueName="GPSImei" HeaderStyle-Width="100px" FilterControlWidth="80px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" >
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="GPSImeiName" HeaderText="Nombre GPSImei" UniqueName="GPSImeiName" HeaderStyle-Width="100px" FilterControlWidth="80px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" >
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="BusRouteID" HeaderText="Ruta ID" UniqueName="BusRouteID" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="BusRouteName" HeaderText="Ruta" UniqueName="BusRouteName" HeaderStyle-Width="100px" FilterControlWidth="80px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" >
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Date" HeaderText="Fecha" UniqueName="Date" HeaderStyle-Width="80px" FilterControlWidth="60px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" >
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="TimeBegin" HeaderText="Hora Desde" UniqueName="TimeBegin" HeaderStyle-Width="80px" FilterControlWidth="60px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" >
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="TimeEnd" HeaderText="Hora Hasta" UniqueName="TimeEnd" HeaderStyle-Width="80px" FilterControlWidth="60px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" >
                        </telerik:GridBoundColumn>
                    </Columns>

                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                    </EditFormSettings>

                    <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                </MasterTableView>

                <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                    <ClientSettings EnableRowHoverStyle="true">
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True">
                        </Scrolling>  <Selecting AllowRowSelect="True"></Selecting><ClientEvents OnPopUpShowing="PopUpShowing" />
                    </ClientSettings>
                <FilterMenu EnableImageSprites="False"></FilterMenu>
            </telerik:RadGrid> 

        </telerik:RadPageView>
        </telerik:RadMultiPage>
            <uc1:DriverSearch ID="DriverSearch" runat="server" IsMultipleSelects="false" CalledBy="VPCControl" IsClearGridAfterClose="false" OnOnAcceptEvent="uscDriverSearch_OnAcceptEvent" OnOnCancelEvent="uscDriverSearch_OnCancelEvent"/>            
            <uc1:GPSSearch ID="GPSSearch" runat="server" IsMultipleSelects="false" CalledBy="VPCControl" IsClearGridAfterClose="false" OnOnAcceptEvent="uscGPSSearch_OnAcceptEvent" OnOnCancelEvent="uscGPSSearch_OnCancelEvent"/>                
            <uc1:BusRoutesSearch ID="uscBusRoutesSearch" runat="server" IsMultipleSelects="false" CalledBy="VPCControl" IsClearGridAfterClose="false" OnOnAcceptEvent="uscBusRoutesSearch_OnAcceptEvent" OnOnCancelEvent="uscBusRoutesSearch_OnCancelEvent"/>            
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>       
    </form>
</body>
</html>
